import 'package:flutter/material.dart';
import 'package:flutter_ncsjqz_getx/http/dio_service.dart';
import 'package:flutter_ncsjqz_getx/model/base_entity.dart';
import 'package:flutter_ncsjqz_getx/util/open_util.dart';
import 'package:flutter_ncsjqz_getx/widget/app_bar_widget.dart';
import 'package:flutter_ncsjqz_getx/widget/ink_widget.dart';
import 'package:get/get.dart';

import 'platform_service_logic.dart';

/// <summary>
/// todo: 平台客服
/// author：zwb
/// dateTime： 2021/11/8 09:58
/// filePath： lib/page/my/platform_service/platform_service_view.dart
/// desc:
/// <summary>
///
class PlatformServicePage extends StatefulWidget {
  @override
  _PlatformServicePageState createState() => _PlatformServicePageState();
}

class _PlatformServicePageState extends State<PlatformServicePage> {
  final logic = Get.put(PlatformServiceLogic());
  BaseEntity baseEntity = BaseEntity();
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    getData();
  }

  /// 获取平台客服信息
  getData() async{
    baseEntity  = await DioService<BaseEntity>().platformCustomerService();
    setState(() { });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: appBarWidget(title: "平台客服"),
      body: baseEntity.data == null ?SizedBox(): Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          InkWidget.imgAsset("kfbg.png",height: Get.width,fit: BoxFit.cover,padding: EdgeInsets.all(15)),
          InkWidget.title("\n客服信息",fonSize: 18),
          InkWidget.text("\n若有什么疑问或者需要什么帮助请联系我们的",color: Colors.grey,),
          InkWidget.text("\n客服电话：${baseEntity.data["phone"]}",fonSize: 18,onTap: (){
            OpenUrl.schemesLaunch("tel:"+baseEntity.data["phone"]);
          }),
          InkWidget.text("客服微信：${baseEntity.data["weChat"]}",fonSize: 18),
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<PlatformServiceLogic>();
    super.dispose();
  }
}